package pe.gob.mimp.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "MENU")
@NamedQueries({ @NamedQuery(name = "Menu.findAll", query = "SELECT m FROM Menu m") })
public class Menu implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@Column(name = "ID_MENU")
	private Long idMenu;
	@Column(name = "DESCRIPCION")
	private String descripcion;
	@Column(name = "MENU_PADRE")
	private String menuPadre;
	@Column(name = "NIVEL")
	private String nivel;
	@Column(name = "ORDEN")
	private String orden;
	@Column(name = "PAGINA")
	private String pagina;
	@JoinTable(name = "MENU_PERFIL", joinColumns = { @JoinColumn(name = "ID_MENU", referencedColumnName = "ID_MENU") }, inverseJoinColumns = { @JoinColumn(name = "ID_PERFIL", referencedColumnName = "ID_PERFIL") })
	@ManyToMany
	private List<Perfil> perfilList;

	public Menu() {
	}

	public Menu(Long idMenu) {
		this.idMenu = idMenu;
	}

	public Long getIdMenu() {
		return idMenu;
	}

	public void setIdMenu(Long idMenu) {
		this.idMenu = idMenu;
	}

	public String getDescripcion() {
		return descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	public String getMenuPadre() {
		return menuPadre;
	}

	public void setMenuPadre(String menuPadre) {
		this.menuPadre = menuPadre;
	}

	public String getNivel() {
		return nivel;
	}

	public void setNivel(String nivel) {
		this.nivel = nivel;
	}

	public String getOrden() {
		return orden;
	}

	public void setOrden(String orden) {
		this.orden = orden;
	}

	public String getPagina() {
		return pagina;
	}

	public void setPagina(String pagina) {
		this.pagina = pagina;
	}

	public List<Perfil> getPerfilList() {
		return perfilList;
	}

	public void setPerfilList(List<Perfil> perfilList) {
		this.perfilList = perfilList;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (idMenu != null ? idMenu.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof Menu)) {
			return false;
		}
		Menu other = (Menu) object;
		if ((this.idMenu == null && other.idMenu != null)
				|| (this.idMenu != null && !this.idMenu.equals(other.idMenu))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "pe.gob.mimp.model.Menu[ idMenu=" + idMenu + " ]";
	}

}
